Skip to content

gpui: Small tab group performance improvements#41885

Merged
Anthony-Eid merged 4 commits into
zed-industries:mainfrom
tidely:tabgroup-perf
Dec 18, 2025
Merged

gpui: Small tab group performance improvements#41885
Anthony-Eid merged 4 commits into
zed-industries:mainfrom
tidely:tabgroup-perf

Conversation

@tidely
Copy link
Copy Markdown
Contributor

@tidely tidely commented Nov 4, 2025

Closes #ISSUE

Removes a few eager container clones and iterations.

Added a todo to get_prev_tab_group_window and get_next_tab_group_window. They seem to use HashMap::keys() for choosing the previous tab group, however .keys() returns an arbitrary order, so I'm not sure if previous actually means anything here. Conrad seems to have worked on this part previously, maybe he has some insights. That can possibly be a follow-up PR, but I'd be willing to work on it here as well since the other changes are so simple.

Release Notes:

  • N/A or Added/Fixed/Improved ...

We unnecessarily looked for the group id and then looked it up in the
hashmap, when we could iterate through the group right away
@cla-bot cla-bot Bot added the cla-signed The user has signed the Contributor License Agreement label Nov 4, 2025
@github-actions github-actions Bot added the community champion Issues filed by our amazing community champions! 🫶 label Nov 4, 2025
@JosephTLyons
Copy link
Copy Markdown
Collaborator

Thanks for the PR @tidely, we'll check it out.

Comment thread crates/gpui/src/app.rs
@@ -341,12 +343,9 @@ impl SystemWindowTabController {

/// Get all tabs in the same window.
pub fn tabs(&self, id: WindowId) -> Option<&Vec<SystemWindowTab>> {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has become such a small helper that I'd consider removing it entirely. It's only called a few times and the majority of the time, we use .position() right after to find the index of tab with the right WindowId. Which could be done right away instead of using the helper first, thus removing an iteration through the values.

@Anthony-Eid Anthony-Eid merged commit 2a713c5 into zed-industries:main Dec 18, 2025
25 checks passed
@github-project-automation github-project-automation Bot moved this from Community Champion PRs to Done in Quality Week – December 2025 Dec 18, 2025
@Anthony-Eid
Copy link
Copy Markdown
Contributor

Thank you for the PR!

rtfeldman pushed a commit that referenced this pull request Jan 5, 2026
Closes #ISSUE

Removes a few eager container clones and iterations.

Added a todo to `get_prev_tab_group_window` and
`get_next_tab_group_window`. They seem to use `HashMap::keys()` for
choosing the previous tab group, however `.keys()` returns an arbitrary
order, so I'm not sure if previous actually means anything here. Conrad
seems to have worked on this part previously, maybe he has some
insights. That can possibly be a follow-up PR, but I'd be willing to
work on it here as well since the other changes are so simple.

Release Notes:

- N/A
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement community champion Issues filed by our amazing community champions! 🫶

Projects

Development

Successfully merging this pull request may close these issues.

4 participants